package com.ushine.design.design.c_behavioral_pattern.e_mediator.b_example;

public class Client {
    public static void main(String[] args) {
        //定义中介者对象
        ConcreteMediator mediator = new ConcreteMediator();

        //定义同事对象
        Button button = new Button();
        List list = new List();
        ComboxBox comboxBox = new ComboxBox();
        TextBox textBox = new TextBox();

        button.setMediator(mediator);
        list.setMediator(mediator);
        comboxBox.setMediator(mediator);
        textBox.setMediator(mediator);


        mediator.addButton = button;
        mediator.bo = comboxBox;
        mediator.list = list;
        mediator.userNameTextBox = textBox;

        button.changed();
        System.out.println("----------------------");
        list.changed();
    }
}
